//========encoding:utf-8=========
/*
 * @describe:  三目运算符
 * @author:mhao
 * @copyright:chinasoft.cn
 * @date:2020年2月10日   上午11:16:00
 */
package edu.chinasoft.filter;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

import org.apache.log4j.Logger;

public class Filter01 implements Filter{
	private static Logger logger = Logger.getLogger(Filter01.class);
	@Override
	public void destroy() {
		// TODO Auto-generated method stub
		logger.debug("Filter01>>> destroy  start ……");
		logger.debug("Filter01>>> destroy  end ……");
	}
	//相当于Servlet的service方法，所有的业务逻辑必须要放在该方法里
	//所有代码必须要放在run方法
	@Override
	public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain)
			throws IOException, ServletException {
		// TODO Auto-generated method stub
		logger.debug("Filter01>>>doFilter  start……");
		logger.debug("Filter01>>>doFilter  end……");
		//执行所请求的资源
		//调用下一个过滤器对象的doFilter方法
		//则会执行请求资源
		filterChain.doFilter(request, response);
	}

	@Override
	public void init(FilterConfig arg0) throws ServletException {
		// TODO Auto-generated method stub
		logger.debug("Filter01>>> init  start ……");
		logger.debug("Filter01>>> init  end ……");
	}

}
